<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>登录界面</title>
		<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css"/>
		<script src="js/jquery.min.js"></script>
	</head>
	<body>
		<div class="container" style="width: 300px;margin-top: 100px;">
			<fieldset>
			<legend>
			登录</legend>
			<div class="form-group">
				<label for="username">用户名：</label>
				<input class="form-control" autocomplete="off"
				 type="text" name="username" id="username" />
			</div>
			<div class="form-group">
			<label for="password">密码：</label>
			<input class="form-control" autocomplete="off"
			type="password" name="password" id="password"  />
			</div>
			<div>
				<button id="btnSAve" class="btn btn-primary" onclick="save()">保存</button>
				<button id="btnClear" class="btn btn-danger"onclick="clera()">取消</button>
			</div>
			</fieldset>
		</div>
	</body>
	<script>
		
		function save(){
			console.log(("#username").val());
			console.log("#password").val();
		}
		function clera(){
			$("#username").val('');
			$("#password").val('');
		}
		//上面的方式前期绑定，jQuery后期绑定（js),动态给按钮添加事件
		//后期绑定实现步骤：1，获取按钮2，
		$("#btnSAve").click(function(){
			var uesename =$("#username").val();
			var password= $("#password").val();
			console.log(uesename+","+password)
		})
		$("#btnClear").click(function(){
			$("#username").val('');
			$("#password").val('');
		})
	</script>
</html>